﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace Moon.Sql
{
    public interface IQueryableUnion
    {
        IQueryableUnion Union<T>(IQueryable<T> queryable);
        IQueryableUnion UnionAll<T>(IQueryable<T> queryable);
        List<T> ToList<T>();
        Task<List<T>> ToListAsync<T>();
    }

    public interface IQueryable<T>
    {
        IQueryable<T> Where(Expression<Func<T, bool>> where);
        IQueryable<T> Where(string where, object dynamic = null);
        T First(object id);
        Task<T> FirstAsync(object id);
        /// <summary>
        /// 设置表名
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="isQuote">是否转义</param>
        /// <returns></returns>
        IQueryable<T> TableName(string tableName = null, bool isQuote = true);
        IQueryable<T> Count(Expression<Func<T, object>> field);
        IQueryable<T> Count(string field);
        IQueryable<T> Sum(Expression<Func<T, object>> field);
        IQueryable<T> Sum(string field);
        IQueryable<T> Avg(Expression<Func<T, object>> field);
        IQueryable<T> Avg(string field);
        IQueryable<T> Max(Expression<Func<T, object>> field);
        IQueryable<T> Max(string field);
        IQueryable<T> Min(Expression<Func<T, object>> field);
        IQueryable<T> Min(string field);
        IQueryable<T> OrderBy(Expression<Func<T, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T> Select(Expression<Func<T, object>> field);
        IQueryable<T> Select(string field);

        bool Any();
        bool NotAny();
        bool Contains(Expression<Func<T, object>> field);
        bool NotContains(Expression<Func<T, object>> field);
        TResult Select<TResult>(Expression<Func<T, object>> field);

        IQueryable<T> GroupBy(Expression<Func<T, object>> field);
        IQueryable<T> GroupBy(string field);
        IQueryable<T> Having(Expression<Func<T, bool>> where);
        IQueryable<T> Having(string where, object dynamic = null);
        List<T> ToList();
        Task<List<T>> ToListAsync();
        T First();
        Task<T> FirstAsync();
        TResult First<TResult>();
        Task<TResult> FirstAsync<TResult>();
        List<TResult> ToList<TResult>();
        Task<List<TResult>> ToListAsync<TResult>();
        IQueryable<T> Distinct();
        DataTable ToDataTable();
        Task<DataTable> ToDataTableAsync();
        IQueryable<T> Take(int limit);
        IQueryable<T> ToPage(int offset, int limit);
        QueryPageResult<TResult> ToPageList<TResult>(int offset, int limit);
        Task<QueryPageResult<TResult>> ToPageListAsync<TResult>(int offset, int limit);
        int Into<TTarget>(Expression<Func<TTarget, object>> field = null);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="columns">col1,col2 多个,分隔</param>
        /// <returns></returns>
        int Into(string tableName, string columns);
        Task<int> IntoAsync<TTarget>(Expression<Func<TTarget, object>> field = null);
        SqlBuilderResult ToSql();
        IQueryable<T> RowLock();
        void SetNestedQuery<T1, T2>(IQueryable<T1> query1, IQueryable<T2> query2);
        IQueryable<T> NewTable();
    }

    #region T2-T10
    public interface IQueryable<T, T2> : IQueryable<T>
    {
        IQueryable<T, T2> TableName(string tableName = null, string tableName2 = null, bool isQuote = true);
        IQueryable<T, T2> Where(Expression<Func<MoonFunc<T, T2>, bool>> where);
        new IQueryable<T, T2> Where(string where, object dynamic = null);
        IQueryable<T, T2> Count(Expression<Func<MoonFunc<T, T2>, object>> field);
        IQueryable<T, T2> Count(string field);
        IQueryable<T, T2> Sum(Expression<Func<MoonFunc<T, T2>, object>> field);
        IQueryable<T, T2> Sum(string field);
        IQueryable<T, T2> Avg(Expression<Func<MoonFunc<T, T2>, object>> field);
        IQueryable<T, T2> Avg(string field);
        IQueryable<T, T2> Max(Expression<Func<MoonFunc<T, T2>, object>> field);
        IQueryable<T, T2> Max(string field);
        IQueryable<T, T2> Min(Expression<Func<MoonFunc<T, T2>, object>> field);
        IQueryable<T, T2> Min(string field);
        IQueryable<T, T2> OrderBy(Expression<Func<MoonFunc<T, T2>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2> Select(Expression<Func<MoonFunc<T, T2>, object>> field);
        new IQueryable<T, T2> Select(string field);
        IQueryable<T, T2> LeftJoin(Expression<Func<MoonFunc<T, T2>, bool>> join);
        IQueryable<T, T2> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2> InnerJoin(Expression<Func<MoonFunc<T, T2>, bool>> join);
        IQueryable<T, T2> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2> Take(int limit);
        IQueryable<T, T2> GroupBy(Expression<Func<MoonFunc<T, T2>, object>> field);
        new IQueryable<T, T2> GroupBy(string field);
        IQueryable<T, T2> Having(Expression<Func<MoonFunc<T, T2>, bool>> where);
        new IQueryable<T, T2> Having(string where, object dynamic = null);
        new IQueryable<T, T2> Distinct();
        new IQueryable<T, T2> NewTable();
        new IQueryable<T, T2> ToPage(int offset, int limit);
    }

    public interface IQueryable<T, T2, T3> : IQueryable<T>
    {
        IQueryable<T, T2, T3> TableName(string tableName = null, string tableName2 = null, string tableName3 = null, bool isQuote = true);
        IQueryable<T, T2, T3> Where(Expression<Func<MoonFunc<T, T2, T3>, bool>> where);
        new IQueryable<T, T2, T3> Where(string where, object dynamic = null);
        IQueryable<T, T2, T3> Count(Expression<Func<MoonFunc<T, T2, T3>, object>> field);
        IQueryable<T, T2, T3> Count(string field);
        IQueryable<T, T2, T3> Sum(Expression<Func<MoonFunc<T, T2, T3>, object>> field);
        IQueryable<T, T2, T3> Sum(string field);
        IQueryable<T, T2, T3> Avg(Expression<Func<MoonFunc<T, T2, T3>, object>> field);
        IQueryable<T, T2, T3> Avg(string field);
        IQueryable<T, T2, T3> Max(Expression<Func<MoonFunc<T, T2, T3>, object>> field);
        IQueryable<T, T2, T3> Max(string field);
        IQueryable<T, T2, T3> Min(Expression<Func<MoonFunc<T, T2, T3>, object>> field);
        IQueryable<T, T2, T3> Min(string field);
        IQueryable<T, T2, T3> OrderBy(Expression<Func<MoonFunc<T, T2, T3>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2, T3> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2, T3> Select(Expression<Func<MoonFunc<T, T2, T3>, object>> field);
        new IQueryable<T, T2, T3> Select(string field);
        IQueryable<T, T2, T3> LeftJoin(Expression<Func<MoonFunc<T, T2, T3>, bool>> join);
        IQueryable<T, T2, T3> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2, T3> InnerJoin(Expression<Func<MoonFunc<T, T2, T3>, bool>> join);
        IQueryable<T, T2, T3> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2, T3> Take(int limit);
        IQueryable<T, T2, T3> GroupBy(Expression<Func<MoonFunc<T, T2, T3>, object>> field);
        new IQueryable<T, T2, T3> GroupBy(string field);
        IQueryable<T, T2, T3> Having(Expression<Func<MoonFunc<T, T2, T3>, bool>> where);
        new IQueryable<T, T2, T3> Having(string where, object dynamic = null);
        new IQueryable<T, T2, T3> Distinct();
        new IQueryable<T, T2, T3> NewTable();
        new IQueryable<T, T2, T3> ToPage(int offset, int limit);
    }

    public interface IQueryable<T, T2, T3, T4> : IQueryable<T>
    {
        IQueryable<T, T2, T3, T4> TableName(string tableName = null, string tableName2 = null, string tableName3 = null, string tableName4 = null, bool isQuote = true);
        IQueryable<T, T2, T3, T4> Where(Expression<Func<MoonFunc<T, T2, T3, T4>, bool>> where);
        new IQueryable<T, T2, T3, T4> Where(string where, object dynamic = null);
        IQueryable<T, T2, T3, T4> Count(Expression<Func<MoonFunc<T, T2, T3, T4>, object>> field);
        IQueryable<T, T2, T3, T4> Count(string field);
        IQueryable<T, T2, T3, T4> Sum(Expression<Func<MoonFunc<T, T2, T3, T4>, object>> field);
        IQueryable<T, T2, T3, T4> Sum(string field);
        IQueryable<T, T2, T3, T4> Avg(Expression<Func<MoonFunc<T, T2, T3, T4>, object>> field);
        IQueryable<T, T2, T3, T4> Avg(string field);
        IQueryable<T, T2, T3, T4> Max(Expression<Func<MoonFunc<T, T2, T3, T4>, object>> field);
        IQueryable<T, T2, T3, T4> Max(string field);
        IQueryable<T, T2, T3, T4> Min(Expression<Func<MoonFunc<T, T2, T3, T4>, object>> field);
        IQueryable<T, T2, T3, T4> Min(string field);
        IQueryable<T, T2, T3, T4> OrderBy(Expression<Func<MoonFunc<T, T2, T3, T4>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2, T3, T4> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2, T3, T4> Select(Expression<Func<MoonFunc<T, T2, T3, T4>, object>> field);
        new IQueryable<T, T2, T3, T4> Select(string field);
        IQueryable<T, T2, T3, T4> LeftJoin(Expression<Func<MoonFunc<T, T2, T3, T4>, bool>> join);
        IQueryable<T, T2, T3, T4> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2, T3, T4> InnerJoin(Expression<Func<MoonFunc<T, T2, T3, T4>, bool>> join);
        IQueryable<T, T2, T3, T4> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2, T3, T4> Take(int limit);
        IQueryable<T, T2, T3, T4> GroupBy(Expression<Func<MoonFunc<T, T2, T3, T4>, object>> field);
        new IQueryable<T, T2, T3, T4> GroupBy(string field);
        IQueryable<T, T2, T3, T4> Having(Expression<Func<MoonFunc<T, T2, T3, T4>, bool>> where);
        new IQueryable<T, T2, T3, T4> Having(string where, object dynamic = null);
        new IQueryable<T, T2, T3, T4> Distinct();
        new IQueryable<T, T2, T3, T4> NewTable();
        new IQueryable<T, T2, T3, T4> ToPage(int offset, int limit);
    }

    public interface IQueryable<T, T2, T3, T4, T5> : IQueryable<T>
    {
        IQueryable<T, T2, T3, T4, T5> TableName(string tableName = null, string tableName2 = null, string tableName3 = null, string tableName4 = null, string tableName5 = null, bool isQuote = true);
        IQueryable<T, T2, T3, T4, T5> Where(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5> Where(string where, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5> Count(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, object>> field);
        IQueryable<T, T2, T3, T4, T5> Count(string field);
        IQueryable<T, T2, T3, T4, T5> Sum(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, object>> field);
        IQueryable<T, T2, T3, T4, T5> Sum(string field);
        IQueryable<T, T2, T3, T4, T5> Avg(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, object>> field);
        IQueryable<T, T2, T3, T4, T5> Avg(string field);
        IQueryable<T, T2, T3, T4, T5> Max(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, object>> field);
        IQueryable<T, T2, T3, T4, T5> Max(string field);
        IQueryable<T, T2, T3, T4, T5> Min(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, object>> field);
        IQueryable<T, T2, T3, T4, T5> Min(string field);
        IQueryable<T, T2, T3, T4, T5> OrderBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2, T3, T4, T5> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2, T3, T4, T5> Select(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, object>> field);
        new IQueryable<T, T2, T3, T4, T5> Select(string field);
        IQueryable<T, T2, T3, T4, T5> LeftJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, bool>> join);
        IQueryable<T, T2, T3, T4, T5> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5> InnerJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, bool>> join);
        IQueryable<T, T2, T3, T4, T5> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5> Take(int limit);
        IQueryable<T, T2, T3, T4, T5> GroupBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, object>> field);
        new IQueryable<T, T2, T3, T4, T5> GroupBy(string field);
        IQueryable<T, T2, T3, T4, T5> Having(Expression<Func<MoonFunc<T, T2, T3, T4, T5>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5> Having(string where, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5> Distinct();
        new IQueryable<T, T2, T3, T4, T5> NewTable();
        new IQueryable<T, T2, T3, T4, T5> ToPage(int offset, int limit);
    }

    public interface IQueryable<T, T2, T3, T4, T5, T6> : IQueryable<T>
    {
        IQueryable<T, T2, T3, T4, T5, T6> TableName(string tableName = null, string tableName2 = null, string tableName3 = null, string tableName4 = null, string tableName5 = null, string tableName6 = null, bool isQuote = true);
        IQueryable<T, T2, T3, T4, T5, T6> Where(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6> Where(string where, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6> Count(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6> Count(string field);
        IQueryable<T, T2, T3, T4, T5, T6> Sum(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6> Sum(string field);
        IQueryable<T, T2, T3, T4, T5, T6> Avg(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6> Avg(string field);
        IQueryable<T, T2, T3, T4, T5, T6> Max(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6> Max(string field);
        IQueryable<T, T2, T3, T4, T5, T6> Min(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6> Min(string field);
        IQueryable<T, T2, T3, T4, T5, T6> OrderBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2, T3, T4, T5, T6> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2, T3, T4, T5, T6> Select(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6> Select(string field);
        IQueryable<T, T2, T3, T4, T5, T6> LeftJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6> InnerJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6> Take(int limit);
        IQueryable<T, T2, T3, T4, T5, T6> GroupBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6> GroupBy(string field);
        IQueryable<T, T2, T3, T4, T5, T6> Having(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6> Having(string where, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6> Distinct();
        new IQueryable<T, T2, T3, T4, T5, T6> NewTable();
        new IQueryable<T, T2, T3, T4, T5, T6> ToPage(int offset, int limit);
    }

    public interface IQueryable<T, T2, T3, T4, T5, T6, T7> : IQueryable<T>
    {
        IQueryable<T, T2, T3, T4, T5, T6, T7> TableName(string tableName = null, string tableName2 = null, string tableName3 = null, string tableName4 = null, string tableName5 = null, string tableName6 = null, string tableName7 = null, bool isQuote = true);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Where(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6, T7> Where(string where, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Count(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Count(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Sum(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Sum(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Avg(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Avg(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Max(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Max(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Min(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Min(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> OrderBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2, T3, T4, T5, T6, T7> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Select(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6, T7> Select(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> LeftJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6, T7> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6, T7> InnerJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6, T7> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6, T7> Take(int limit);
        IQueryable<T, T2, T3, T4, T5, T6, T7> GroupBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6, T7> GroupBy(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7> Having(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6, T7> Having(string where, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6, T7> Distinct();
        new IQueryable<T, T2, T3, T4, T5, T6, T7> NewTable();
        new IQueryable<T, T2, T3, T4, T5, T6, T7> ToPage(int offset, int limit);
    }

    public interface IQueryable<T, T2, T3, T4, T5, T6, T7, T8> : IQueryable<T>
    {
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> TableName(string tableName = null, string tableName2 = null, string tableName3 = null, string tableName4 = null, string tableName5 = null, string tableName6 = null, string tableName7 = null, string tableName8 = null, bool isQuote = true);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Where(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Where(string where, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Count(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Count(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Sum(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Sum(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Avg(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Avg(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Max(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Max(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Min(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Min(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> OrderBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Select(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Select(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> LeftJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> InnerJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Take(int limit);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> GroupBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> GroupBy(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Having(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Having(string where, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> Distinct();
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> NewTable();
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8> ToPage(int offset, int limit);
    }

    public interface IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> : IQueryable<T>
    {
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> TableName(string tableName = null, string tableName2 = null, string tableName3 = null, string tableName4 = null, string tableName5 = null, string tableName6 = null, string tableName7 = null, string tableName8 = null, string tableName9 = null, bool isQuote = true);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Where(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Where(string where, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Count(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Count(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Sum(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Sum(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Avg(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Avg(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Max(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Max(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Min(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Min(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> OrderBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Select(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Select(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> LeftJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> InnerJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Take(int limit);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> GroupBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> GroupBy(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Having(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Having(string where, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> Distinct();
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> NewTable();
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> ToPage(int offset, int limit);
    }

    public interface IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> : IQueryable<T>
    {
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> TableName(string tableName = null, string tableName2 = null, string tableName3 = null, string tableName4 = null, string tableName5 = null, string tableName6 = null, string tableName7 = null, string tableName8 = null, string tableName9 = null, string tableName10 = null, bool isQuote = true);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Where(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Where(string where, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Count(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Count(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Sum(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Sum(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Avg(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Avg(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Max(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Max(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Min(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, object>> field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Min(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> OrderBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, object>> field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> OrderBy(string field, OrderBy orderBy = Moon.Sql.OrderBy.Asc);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Select(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Select(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> LeftJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> LeftJoin(string join, object dynamic = null);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> InnerJoin(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, bool>> join);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> InnerJoin(string join, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Take(int limit);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> GroupBy(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, object>> field);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> GroupBy(string field);
        IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Having(Expression<Func<MoonFunc<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>, bool>> where);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Having(string where, object dynamic = null);
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Distinct();
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> NewTable();
        new IQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> ToPage(int offset, int limit);
    }
    #endregion T2-T10
}